package com.simple.core.util;

import javax.annotation.Nullable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 会话上下文信息工具类
 *
 * @author FanXing
 * @date 2023年02月03日 13:54
 */
public interface SessionContext {

    default Long getCurrentUserIdAsLong() {
        return Long.valueOf(this.getCurrentUserId());
    }

    @Nullable
    default Long getCurrentCommunityIdAsLong() {
        String communityId = this.getCurrentCommunityId();
        if (communityId == null) {
            return null;
        }
        try {
            return Long.valueOf(communityId);
        } catch (Throwable throwable) {
            return null;
        }
    }

    default String getCurrentUserId() {
        return "test_user";
    }

    @Nullable
    default String getCurrentCommunityId() {
        return "2";
    }

    default Long getCurrentTenantId() {
        return 0L;
    }

    default String getCurrentTenantCode() {
        return "";
    }


}
